package t2;

import java.util.Scanner;

import t2bean.LibraryBean;

public class Client {

	public static void main(String[] args) {
		int a = 1;

		LibraryBean library = new LibraryBean();
		BookAction bookAction = new BookAction();
		CardAction bookCardAction = new CardAction();
		Scanner cin = Cin.open();

		while (a == 1) {
			System.out.println("输入1进书");
			System.out.println("输入2办理借书卡");

			System.out.println("输入3借书");
			System.out.println("输入4还书");

			System.out.println("输入5查询某书的借阅记录");
			System.out.println("输入6查询某卡的借阅记录");

			System.out.println("输入7显示图书信息");

			System.out.println("输入0退出");

			String str;
			str = cin.nextLine();

			if (str.equals("0")) {
				System.out.println("退出成功");
				break;
			}
			if (str.equals("1")) {
				library = bookAction.add(library);
			}
			if (str.equals("2")) {
				library = bookCardAction.add(library);
			}
			if (str.equals("3")) {
				library = bookAction.lendBook(library);
			}
			if (str.equals("4")) {
				library = bookAction.returnBook(library);
			}
			if (str.equals("5")) {
				bookAction.searchRecord(library);
			}
			if (str.equals("6")) {
				bookCardAction.searchRecord(library);
			}
			if (str.equals("7")) {
				bookAction.showBook(library);
			}
			str = null;

		}
		Cin.close();
	}

}
